package errorsys;

import org.springframework.web.bind.annotation.*;

/**
 *  获取返回码和响应的
 */
@RestController
@RequestMapping("/ErrorSys/${version}")
public class GetMethod {

    //TradeSys获取错误描述的接口
    @GetMapping("/getTradeSysCode/{code}")
    public String getTradeSysCode(@PathVariable String code) {
        String respDesc = "";
        if ("0001".equals(code)) {
            respDesc = ErrorCode.TradeSysDbError;
        } else if ("0002".equals(code)) {
            respDesc = ErrorCode.TradeSysError;
        }
        return respDesc;
    }

    @RequestMapping(value = "/getRegistErrorCode")
    public String getRegistErrorCode(@RequestParam("code")String code){
        String respDesc = "";
        if ("0009".equals(code)) {
            respDesc = ErrorCode.RegistError;
        } else if ("0010".equals(code)) {
            respDesc = ErrorCode.RegistInputUserInfoError;
        }
        return respDesc;
    }

    //MessageSys获取错误描述的接口
    @GetMapping("/getMessageSysCode/{code}")
    public String getMessageSysCode(@PathVariable String code) {
        String respDesc = "";
        if ("0001".equals(code)) {
            respDesc = ErrorCode.MessageSysDbError;
        } else if ("0002".equals(code)) {
            respDesc = ErrorCode.MessageSysError;
        } else if ("0003".equals(code)) {
            respDesc = ErrorCode.MessageSysNoSmsError;
        } else if ("0004".equals(code)) {
            respDesc = ErrorCode.MessageSysMaxError;
        } else if ("0005".equals(code)) {
            respDesc = ErrorCode.MessageSysAuthError;
        } else if ("0006".equals(code)) {
            respDesc = ErrorCode.MessageTooLangError;
        }
        return respDesc;
    }

}
